/******************************************************************************
**                                                                           **
**                 Proprietary and Confidential Information                  **
**                                                                           **
**                 Copyright (c) Conexant Systems, Inc. Unpublished                  **
**                                                                           **
** This source code and the algorithms implemented therein constitute        **
** confidential information and may compromise trade secrets of Conexant Systems,    **
** Inc. or its associates, and any unauthorized use thereof is prohibited.   **
**                                                                           **
******************************************************************************/

#ifndef dc_dmbimg_api_h
#define dc_dmbimg_api_h

#include "dc_container_api.h"
#include "dc_image_api.h"

// DBGMON WIN32 note.
//
// This header file is used for dbgmon builds to provide prototypes for the 
// data container API functions (to support dbgmon side dbgext which allows
// host dlls to make "calls" to data container API functions).  
//
// To enable API functions to be callable within DBGMON user dlls, we need
// to include the appropriate dll export/import function qualifiers.  For 
// firmware, no function qualifier is used.
//

#ifndef WIN32
# define FUN_QUALIFIER
#else
# define FUN_QUALIFIER CPP DBGMON_API
#endif


#define DC_DMBIMG_PRODUCER DC_DMBBUF_PRODUCER
#define DC_DMBIMG_CONSUMER DC_DMBBUF_CONSUMER

typedef struct DC_DMBIMG_STRUCT
{
  // dmbimg is based on dmbbuf base container
  DC_DMBBUF dmbbuf;
    
  // image attributes
  DC_IMAGE image_attributes;

} DC_DMBIMG;


// better matching names for alerts
#define DC_DMBIMG_ALERT_BYTE_THRESHOLD       DC_CONTAINER_ALERT_THRESHOLD
#define DC_DMBIMG_ALERT_SCANLINE_THRESHOLD   DC_CONTAINER_ALERT_AUX_THRESHOLD
#define DC_DMBIMG_ALERT_PRODUCTION_COMPLETE  DC_CONTAINER_ALERT_PRODUCTION_COMPLETE
#define DC_DMBIMG_ALERT_HEIGHT_SPECIFIED     DC_CONTAINER_ALERT_HEIGHT_SPECIFIED
#define DC_DMBIMG_ALERT_ATTRIBUTES_SPECIFIED DC_CONTAINER_ALERT_ATTRIBUTES_SPECIFIED
#define DC_DMBIMG_ALERT_CONSUMPTION_COMPLETE  DC_CONTAINER_ALERT_CONSUMPTION_COMPLETE
//
//
// DMBIMG container API
//
//

FUN_QUALIFIER DC_RETURN_CODE dc_dmbimg_create 
( DC_DMBIMG *dmbimg,
  char *name,
  DC_IMAGE_CHANNELS channels,
  DC_IMAGE_BITDEPTH bitdepth,
  DC_IMAGE_FORMAT format,
  UINT32 stride,
  UINT32 width,
  UINT32 height );

FUN_QUALIFIER DC_RETURN_CODE dc_dmbimg_info_get
( DC_DMBIMG *dmbimg,
  char **name,
  DC_IMAGE_CHANNELS *channels,
  DC_IMAGE_BITDEPTH *bitdepth,
  DC_IMAGE_FORMAT *format,
  UINT32 *stride,
  UINT32 *width,
  UINT32 *height );

FUN_QUALIFIER DC_RETURN_CODE dc_dmbimg_height_specify
( DC_DMBIMG *dmbimg,
  UINT32 height );

DC_RETURN_CODE dc_dmbimg_attributes_specify
( DC_DMBIMG *dmbimg,
  DC_IMAGE_CHANNELS channels,
  DC_IMAGE_BITDEPTH bitdepth,
  DC_IMAGE_FORMAT format,
  UINT32 stride,
  UINT32 width,
  UINT32 height);

FUN_QUALIFIER DC_RETURN_CODE dc_dmbimg_setup_dmbAllocControl_specify
( DC_DMBIMG *dmbimg,
  UINT32 maxDMBs,
  UINT32 dmbAllocId
  /* TBD allocFilterFcn */ );

//DC_RETURN_CODE dc_dmbimg_delete
//( DC_DMBIMG *container);
#define dc_dmbimg_delete(a) \
        dc_dmbbuf_delete(&(a)->dmbbuf)

// DC_RETURN_CODE dc_dmbimg_status_get
//( DC_DMBIMG *dmbimg,
//  UINT32 *production_state,
//  UINT32 *consumption_state,
//  UINT32 *reserved2, UINT32 *reserved3,
//  UINT32 *reserved4,UINT32 *reserved5, UINT32 *reserved6,
//  UINT32 *reserved7);
#define dc_dmbimg_status_get(a,b,r1,r2,r3,r4,r5,r6,r7) \
        dc_dmbbuf_status_get(&(a)->dmbbuf,b,r1,r2,r3,r4,r5,r6,r7)

//DC_RETURN_CODE dc_dmbimg_producer_setup
//( DC_DMBIMG_PRODUCER *consumer, 
//  char *name,
//  DC_CONTAINER_ALERT_FCN alertFcn,
//  UINT32 alertUserParam);
#define dc_dmbimg_producer_setup dc_dmbbuf_producer_setup

//DC_RETURN_CODE dc_dmbimg_producer_register
//( DC_DMBIMG *dmbimg,
//  DC_DMBIMG_PRODUCER *producer );
#define dc_dmbimg_producer_register(a,b) \
        dc_dmbbuf_producer_register(&(a)->dmbbuf,b)

#if 0
DC_RETURN_CODE dc_dmbimg_producer_alerts_set
( DC_DMBIMG_PRODUCER *producer,
  UINT32 alertMask,
  UINT32 byteThreshold );
#endif
#define dc_dmbimg_producer_alerts_set dc_dmbbuf_producer_alerts_set

#if 0
DC_RETURN_CODE dc_dmbimg_producer_allocate
( DC_DMBIMG_PRODUCER *producer,
  UINT32 desiredEmptyBytes );
#endif
#define dc_dmbimg_producer_allocate dc_dmbbuf_producer_allocate

#if 0
DC_RETURN_CODE dc_dmbimg_producer_empty_get 
( DC_DMBIMG_PRODUCER *producer,
  UINT32 *emptyBytes );
#endif
#define dc_dmbimg_producer_empty_get dc_dmbbuf_producer_empty_get

#if 0
DC_RETURN_CODE dc_dmbimg_producer_segment_get 
( DC_DMBIMG_PRODUCER *producer,
  void **dataPtr,
  UINT32 *nBytes );
#endif
#define dc_dmbimg_producer_segment_get dc_dmbbuf_producer_segment_get

#if 0
DC_RETURN_CODE dc_dmbimg_producer_produce
( DC_DMBIMG_PRODUCER *producer,
  UINT32 bytes,
  UINT32 scanlines );
#endif
#define dc_dmbimg_producer_produce dc_dmbbuf_producer_produce

//DC_RETURN_CODE dc_dmbimg_producer_unregister
//( DC_DMBIMG_PRODUCER *producer );
#define dc_dmbimg_producer_unregister dc_dmbbuf_producer_unregister


//DC_RETURN_CODE dc_dmbimg_consumer_setup
//( DC_DMBIMG_CONSUMER *consumer, 
//  char *name,
//  DC_CONTAINER_ALERT_FCN alertFcn,
//  UINT32 alertUserParam);
#define dc_dmbimg_consumer_setup dc_dmbbuf_consumer_setup

//DC_RETURN_CODE dc_dmbimg_consumer_register
//( DC_DMBIMG *dmbimg,
//  DC_DMBIMG_CONSUMER *consumer );
#define dc_dmbimg_consumer_register(a,b) \
        dc_dmbbuf_consumer_register(&(a)->dmbbuf,b)

#if 0
DC_RETURN_CODE dc_dmbimg_consumer_alerts_set
( DC_DMBIMG_CONSUMER *consumer,
  UINT32 alertMask,
  UINT32 byteThreshold,
  UINT32 scanlineThreshold );
#endif
#define dc_dmbimg_consumer_alerts_set dc_dmbbuf_consumer_alerts_set

#if 0
DC_RETURN_CODE dc_dmbimg_consumer_valid_get 
( DC_DMBIMG_CONSUMER *consumer,
  UINT32 *validBytes,
  UINT32 *validScalines );
#endif
#define dc_dmbimg_consumer_valid_get dc_dmbbuf_consumer_valid_get

#if 0
DC_RETURN_CODE dc_dmbimg_consumer_segment_get 
( DC_DMBIMG_CONSUMER *consumer,
  void **dataPtr,
  UINT32 *nBytes );
#endif
#define dc_dmbimg_consumer_segment_get dc_dmbbuf_consumer_segment_get

#if 0
DC_RETURN_CODE dc_dmbimg_consumer_consume
( DC_DMBIMG_CONSUMER *consumer,
  UINT32 bytes,
  UINT32 scanlines );
#endif
#define dc_dmbimg_consumer_consume dc_dmbbuf_consumer_consume

//DC_RETURN_CODE dc_dmbimg_consumer_unregister
//( DC_DMBIMG_CONSUMER *consumer );
#define dc_dmbimg_consumer_unregister dc_dmbbuf_consumer_unregister

#define dc__dmbimg_producer_dmb_count_get dc__dmbbuf_producer_dmb_count_get

//DC_RETURN_CODE dc_dmbimg_group_add 
//( DC_CONTAINER_GROUP *group,
//  DC_DMBIMG *container);
#define dc_dmbimg_group_add(a, b) \
        dc_dmbbuf_group_add(a, &(b)->dmbbuf)

//DC_RETURN_CODE dc_dmbimg_group_create 
//( DC_CONTAINER_GROUP *group);
#define dc_dmbimg_group_create dc_dmbbuf_group_create

//DC_RETURN_CODE dc_dmbimg_group_delete 
//( DC_CONTAINER_GROUP *group);
#define dc_dmbimg_group_delete dc_dmbbuf_group_delete

//DC_RETURN_CODE dc_dmbimg_monitor_on
//( DC_CONTAINER_DEBUG_HANDLE handle );
#define dc_dmbimg_monitor_on dc_dmbbuf_monitor_on

#if 0
DC_RETURN_CODE dc_dmbimg_monitor_available_get 
( DC_CONTAINER_DEBUG_HANDLE handle,
  UINT32 *availableBytes,
  UINT32 *availableScalines );
#endif
#define dc_dmbimg_monitor_available_get dc_dmbbuf_monitor_available_get

#if 0
DC_RETURN_CODE dc_dmbimg_monitor_segment_get 
( DC_CONTAINER_DEBUG_HANDLE handle,
  void **dataPtr,
  UINT32 *nBytes );
#endif
#define dc_dmbimg_monitor_segment_get dc_dmbbuf_monitor_segment_get

#if 0
DC_RETURN_CODE dc_dmbimg_monitor_monitor
( DC_CONTAINER_DEBUG_HANDLE handle,
  UINT32 bytes,
  UINT32 scanlines );
#endif
#define dc_dmbimg_monitor_monitor dc_dmbbuf_monitor_monitor

//DC_RETURN_CODE dc_dmbimg_monitor_off
//( DC_CONTAINER_DEBUG_HANDLE handle );
#define dc_dmbimg_monitor_off dc_dmbbuf_monitor_off




FUN_QUALIFIER DC_RETURN_CODE dc_dmbimg_debug_info_get
( DC_CONTAINER_DEBUG_HANDLE handle,
  char **name,
  DC_IMAGE_CHANNELS *channels,
  DC_IMAGE_BITDEPTH *bitdepth,
  DC_IMAGE_FORMAT *format,
  UINT32 *stride,
  UINT32 *width,
  UINT32 *height,
  UINT32 *monitorEnabled,
  UINT32 *producerCumulativeBytes,
  UINT32 *producerCumulativeScanlines,
  UINT32 *consumerCumulativeBytes,
  UINT32 *consumerCumulativeScanlines,
  UINT32 *dmbsAllocated,
  UINT32 *dmbsFreed,
  DC_DMB *dmbHead,
  UINT32 *dmbSizeInBytes,
  DC_DMB *scratch_dmb1,
  UINT32 *scratch_offset1,
  UINT32 *scratch_alignedunit1,
  DC_DMB *scratch_dmb2,
  UINT32 *scratch_offset2,
  UINT32 *scratch_alignedunit2,
  UINT32 *scratch_units );



#undef FUN_QUALIFIER

#endif // dc_dmbimg_api_h
